<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('ad/index')}">{:L('ADMIN_AD_INDEX')}</a></li>
			<li class="active"><a href="{:U('ad/add')}">添加推送</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('ad/add_post')}">
			<fieldset>
				<div class="control-group">
					<label class="control-label">预约内容</label>
					<div class="controls">
						<textarea name="content" rows="2" cols="57"></textarea>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">活动名称</label>
					<div class="controls">
						<input type="text" name="ad_name">
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">温馨提示</label>
					<div class="controls">
						<textarea name="tip_message" rows="3" cols="57"></textarea>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">时间选择</label>
					<div class="controls">
						<select name="end_date" class="end_date">
							<option value="">全部</option>
							<option value="6">6天前</option>
							<option value="5">5天前</option>
							<option value="4">4天前</option>
							<option value="3">3天前</option>
							<option value="2">2天前</option>
							<option value="1">1天前</option>
						</select>
						人数：<span class="user_num"></span>
					</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:L('ADD')}</button>
				<a class="btn" href="javascript:history.back(-1);">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script>
        //确定查询时间
        $('.end_date').on('change',function(){
            var url = "{:U('ad/get_user_num')}";
            var data = {end_date: this.value};
            //获取用户数据
            $.ajax({
                url: url,
                type: "POST",
                dataType: "json",
                data: data,
                success: function (data) {
					$('.user_num').text(data.total_num);
                }
            });
        });
	</script>
</body>
</html>